// index.js
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'

Component({
  data: {
    showVideo: true,
    videoUrl: ''
  },
  methods: {
    // 事件处理函数
    showVideo1() {
      console.log('视频1')
      this.setData({
        showVideo: true,
        videoUrl: 'https://testhsaypic.coolstore.cn/partner/171cddee76471740/1692692940961-测试视频.mp4'
      }, () => {
        const videoContext = wx.createVideoContext('myVideo')
        console.log(videoContext, 'videoContext')
        // 默认全屏
        videoContext.requestFullScreen({
          direction:0
        })
      })
      

    },
    showVideo2() {
      console.log('视频2')
      this.setData({
        showVideo: true,
        videoUrl: 'https://testhsaypic.coolstore.cn/partner/171cddee76471740/1690884012898-视频1.mp4'
      }, () => {
        const videoContext = wx.createVideoContext('myVideo')
        console.log(videoContext, 'videoContext')
        // 默认全屏
        videoContext.requestFullScreen({
          direction:0
        })
      })
      
    },
    fullScreenChange(e) {
      if(!e.detail.fullScreen){
        this.setData({
          showVideo: false
        })
      }
    }
  },
})
